package interfaceGrafica;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import java.awt.event.MouseAdapter;

@SuppressWarnings("serial")
public class JanelaAbout extends JDialog
{
	private JLabel background;
	private JButton back;
	private JLayeredPane painel;
	
	private ImageIcon backgroundImagemAbout;
	private ImageIcon backImagem1;
	private ImageIcon backImagem2;
	private ImageIcon backImagem3;
	
	public JanelaAbout (JanelaInicial janelaInicial)
	{
		
		super(janelaInicial);
		super.setUndecorated(true);
		super.setPreferredSize(new Dimension(372, 280));
		super.setResizable(false);
		super.setModal(true);
		super.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
		super.getContentPane().setLayout(new GridLayout());
		
		backgroundImagemAbout = new ImageIcon(
				"Data\\Imagens\\MenuInicial\\backgroundAbout.png");
		
		backImagem1 = new ImageIcon(
				"Data\\Imagens\\MenuInicial\\backImagem1.png");
		backImagem2 = new ImageIcon(
				"Data\\Imagens\\MenuInicial\\backImagem2.png");
		backImagem3 = new ImageIcon(
				"Data\\Imagens\\MenuInicial\\backImagem3.png");

		painel = new JLayeredPane();
		
		this.background = new JLabel();
		this.background.setIcon(backgroundImagemAbout);
		this.background.setBounds(0, 0, 372, 280);
		painel.add(background, JLayeredPane.DEFAULT_LAYER);
		
		back = new JButton();
		MenuPrincipal.inicializarBotao(painel, back, backImagem1,
				backImagem2, backImagem3, 98, 227,
				backImagem2.getIconWidth(), backImagem2.getIconHeight());
		back.addMouseListener(new MouseAdapter() {
			public void mouseClicked(MouseEvent me) {
				mouseClicar(back, 1);
			}
		});

		super.setContentPane(painel);
		super.pack();
		super.setLocationRelativeTo(null);
	}
	
	private void mouseClicar(JButton botao, int escolha) {
		if (!botao.isEnabled())
			return;
		switch (escolha) {
		case 1:
			this.setVisible(false);
			break;
			
		default:

			break;
		}
	}
	
}
